<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="${package}.dao.mapper.${moduleName}.${ClassName}Mapper">

    <!-- Result Map -->
    <resultMap id="${ClassName}Result" type="${package}.dao.entity.${moduleName}.${ClassName}">
        <#list fieldList as field>
            <result property="${field.attrName}" column="${field.fieldName}"/>
        </#list>
    </resultMap>

    <!-- SQL Fragment for SELECT Fields -->
    <sql id="select${ClassName}Vo">
        select <#list fieldList as field> ${field.fieldName}<#if field?has_next>,</#if> </#list>
        from ${tableName}
    </sql>

    <!-- 分页 -->
    <select id="select${ClassName}List" resultMap="${ClassName}Result">
        <include refid="select${ClassName}Vo"/>
        <where>
            <!-- Add conditions here if needed -->
        </where>
    </select>

    <!-- 详情 -->
    <select id="select${ClassName}ById" resultMap="${ClassName}Result">
        <include refid="select${ClassName}Vo"/>
        <where>
           id  = ${r'#{id}'}
        </where>
    </select>

    <!-- 删除 -->
    <delete id="delete${ClassName}ByIds">
        delete from ${tableName} where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            ${r'#{id}'}
        </foreach>
    </delete>

</mapper>
